Previous Book Contents Book Index Next

Inside Macintosh: Using JBindery /
Chapter 1 - Using JBindery / Examples


Packaging a Java Application

Packaging a Java application to run under the Mac OS creates a file that contains the following items:

The packaged Java application does not contain the Java virtual machine. The host computer that executes the Java application must supply the virtual machine through the MRJ libraries.

To create a packaged Java application using JBindery, you should do the following:

  1. Put all the files your Java application requires into a single folder hierarchy. This folder should not contain any Mac OS resource files.
  2. Drag the class file or zip package containing the application's main method onto the JBindery icon. Alternatively, you can launch JBindery and then enter the class name manually in the Command panel.
  3. In the Command panel, enter any parameters your application requires and choose paths for console output and input.
  4. In the Properties panel, enter any property/value pairs you want to include with your application.
  5. In the Appearance panel, select any desired appearance features.
  6. In the Security panel, specify any proxy servers, if desired, and choose whether you want to use the code verifier.
  7. In the Application panel, choose a signature (also called a creator) for your application. If you plan to distribute your application (whether commercially or as shareware), you should register the creator with Apple. The default creator is '????'. See "The Application Panel" (page 13) for more information.
  8. If desired, you can change the default application heap sizes in the Application panel.
  9. If you have any Mac OS resources you want to include, drag the compiled resource file onto the Merge Resources From box in the Application panel (or click on the box to select the resource file manually). See "Mac OS Resources" (page 20) for more information about resources.
  10. In the Virtual File System panel, drag the folder containing your Java application's class files onto the Copy Contents of Folder Hierarchy box (or click on the box to choose the folder manually).
  11. In the Classpath panel, select the Add Manually button. In the dialog box that appears, enter the name you chose for your virtual file system's root directory as a file URL. Unless you changed the default directory $VFS in the Virtual File System panel, your class path should be file:///$VFS. Select the OK button when finished.
  12. Delete any other class paths so that your virtual file system path is the only one that is searched.
  13. Choose Save Settings... from any of the panels. When the save dialog box appears, choose a name for your packaged Java application file.
  14. Select the Save as Application checkbox in the save dialog box and save your packaged file.

During the save process, JBindery displays some progress information as it packages the files you specified in the Virtual File System panel. The saved file can now be launched like a Mac OS application. Alternatively, if you select the Run button while still in JBindery, JBindery automatically quits and launches your packaged application.

If desired, you can keep the Java application class files separate from the application file by not selecting the Copy Contents of Folder Hierarchy checkbox in the Virtual File System panel. The resulting application files then contains only the following items:

To build a packaged application with separate class files, you should do the following:

  1. Follow steps 2 through 8 as for creating an application with packaged class files.
  2. In the Classpath panel, enter any additional paths you want searched when looking for the Java application's class files.
  3. Choose Save Settings... from any of the panels. When the save dialog box appears, choose a name for your application file.
  4. Select the Save as Application checkbox in the save dialog box and save your packaged file.

The resulting application file can be launched like a Mac OS application assuming that the required Java classes can be found.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 APR 1997